import axios from 'axios'



axios.interceptors.response.use(
  response => {
    let {data: json} = response
    let resp = json
    if(resp) return resp;
    // code == -6 异地登录
    // throw new Error(resp.respDesc)
  },
  error => {
    return Promise.reject(error)
  },
)

export function post(url, data) {
  return axios({
    url: url ,
    method: 'POST',
    data:JSON.stringify(data),
    headers: {
    'token': localStorage['token'],
    'Content-Type':'application/json;charset=UTF-8'
  }
  })
}